package thread;

public class SleepDemo4 {
    public static void main(String[] args) {
        Thread liu = new Thread("刘立新"){
            public void run(){
                try {
                    System.out.println(getName()+":等我回来");
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    System.out.println(getName()+":对不起");
                }
                System.out.println(getName()+":对不起!！");
            }
        };
        Thread zhang = new Thread("老表"){
            public void run (){
                System.out.println(getName()+":滚！");
                for(int i = 0;i<4;i++) {
                    System.out.println(getName() + ":滚");

                    try {
                        Thread.sleep(3000);
                    } catch (InterruptedException e) {
                    }
                }
                System.out.println(getName()+":滚！!");
                liu.interrupt();
            }

        };
       liu.start();
       zhang.start();
    }
}
